import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { SwaggerService } from './services';
import { IPathInfo } from './interfaces';
 
@Component({
  selector: 'ngx-swagger-ui',
  templateUrl: './swagger.component.html',
  styleUrls: ['./styles/index.less'],
  encapsulation: ViewEncapsulation.None
})
export class SwaggerComponent implements OnInit {
  current: IPathInfo | any;

  badgeStyle = {
    backgroundColor: '#fff',
    color: '#999',
    boxShadow: '0 0 0 1px #d9d9d9 inset'
  };

  constructor(
    public service: SwaggerService
  ) { }

  ngOnInit() {
    this.service.loaded.subscribe(data => {
      this.onSelect(this.service.tags[0].urls[0]);
    });
  }

  onSelect(row: IPathInfo | any) {
    this.current = row;
    console.log(this.current); 
  }

}
